<?php
/**
 * Created by b17
 * 2/16/12 7:17 PM
 */

class Admin_AjaxController extends G4T_AdminController
{
    public function tagsAction()
    {
        $searcher = new \Managers\Searchers\WildcardTags();
        $searcher->addName($this->_getParam('q'));
        $manager = new \Managers\Tags();
        $resultManager = new \Managers\Result\Base($searcher, $manager);
        $resultManager->setDecorator(new \Managers\Decorators\Autocomplete());
        try {
            $results = $resultManager->getResult();
            $this->view->data = $results;
        } catch (LogicException $e) {
            // Ничего не найдено.
        }
        $this->renderScript('/ajax/json.phtml');
    }
}
